﻿using eslib.py;
using System;

namespace test
{
    internal class PyTest3
    {
        public void fuck1(int t1)
        {
            Console.WriteLine($"t1={t1}");
        }


        public void fuck2(string w)
        {
            Console.WriteLine("f2:" + w);
        }



        string py1 = @"
i=13
cso.fuck1(i)
";

        string py2 = @"
i=15
cso.fuck1(i)
cso.fuck2('bird')
";


        internal void test()
        {
            PyEngine py = new PyEngine();

            //绑定对象
            py.AddBindObject("cso", this);

            //运行源码或预编译对象
            py.Exec(scope =>
            {
                scope.Exec(py1);
                scope.Exec(py2);

            }).ContinueWith(task =>
            {
                Console.WriteLine("运行结束");
            });
        }
    }
}